﻿<Application
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:DataStore_Repositories="clr-namespace:DataStore.Repositories;assembly=DataStore" x:Class="UI.App" >

    <Application.Resources>

        <Style TargetType="{x:Type TextBox}">
            <Setter Property="Validation.ErrorTemplate">
                <Setter.Value>
                    <ControlTemplate>
                        <DockPanel LastChildFill="True">
                            <Image Source="/Images/error.png" Width="25" Height="25" ToolTip="{Binding ElementName=MyAdorner, 
                               Path=AdornedElement.(Validation.Errors)[0].ErrorContent}" />
                            <!--<TextBlock DockPanel.Dock="Right"
								Foreground="Orange"
								Margin="5" 
								FontSize="12pt"
								Text="{Binding ElementName=MyAdorner, 
                               Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
                            </TextBlock>-->
                            
                            

                            <Border BorderBrush="Red" BorderThickness="3">
                                <AdornedElementPlaceholder Name="MyAdorner" />
                            </Border>

                        </DockPanel>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="Validation.HasError" Value="true">
                    <Setter Property="ToolTip"
						Value="{Binding RelativeSource={RelativeSource Self}, 
                       Path=(Validation.Errors)[0].ErrorContent}"/>
                </Trigger>
            </Style.Triggers>
        </Style>

    </Application.Resources>

</Application>
